<?php
$username =$_GET["username"];
$password =$_GET["password"];

//连接数据库
$con =mysqli_connect("localhost","root","root","helianna");
//把密码加密在进行比对
$password = md5($password);
//查找数据
$sql_select="SELECT * FROM `helianna` WHERE `username` = '$username' AND `password` = '$password'";
//返回结果
$res = mysqli_query($con , $sql_select);
//返回结果进行转换关联数组
$res = mysqli_fetch_all( $res , MYSQLI_ASSOC );
// sizeof API : 查询数组之中存在多少条数据; 
//如果数据大于一条   就显示该数据
if( sizeof($res) >= 1 ){
    echo json_encode($res);
}else{
    echo '{"type":"error", "error" : "未注册账号"}';
}

mysqli_close( $con );
